package net.wzw.enums;

import org.assertj.core.util.Maps;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wzw
 * @date 2025/4/20
 * @Description
 */
public enum FoodDifficulty {

    EASY(1,"简单"),

    AVERAGE(2,"一般"),

    DIFFICULT(3,"较难"),

    EXTREMELY_DIFFICULT(4,"极难");

    private Integer difficulty;

    private String diffucultyValue;


    FoodDifficulty(Integer difficulty, String diffucultyValue) {
        this.difficulty = difficulty;
        this.diffucultyValue = diffucultyValue;
    }



    public static Map<Integer,String > toMap(){

       //Map<Integer,String> map =   Maps.newHashMap();
        Map<Integer,String> map =   new HashMap<>();

       for (FoodDifficulty element : FoodDifficulty.values()){

           map.put(element.getDifficulty(),element.getDiffucultyValue());

       }
       return  map;



    }

    public static FoodDifficulty getByDifficulty(Integer code){

          if(code == null){

              return null;
          }

          for (FoodDifficulty element : FoodDifficulty.values()){

              if(code.equals(element.getDifficulty())){

                  return  element;
              }


          }
        return null;
    }


    public Integer getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(Integer difficulty) {
        this.difficulty = difficulty;
    }

    public String getDiffucultyValue() {
        return diffucultyValue;
    }

    public void setDiffucultyValue(String diffucultyValue) {
        this.diffucultyValue = diffucultyValue;
    }
}
